<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get file status</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.eio-stat" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">eio_stat</h1>
  <p class="verinfo">(PECL eio &gt;= 0.0.1dev)</p><p class="refpurpose"><span class="refname">eio_stat</span> &mdash; <span class="dc-title">Get file status</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.eio-stat-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>eio_stat</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$path</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$pri</code></span>
   , <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$data</code><span class="initializer"> = NULL</span></span>
  ] ) : <span class="type">resource</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>eio_stat()</strong></span> returns file status information in
   <code class="parameter">result</code> argument of <code class="parameter">callback</code>
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.eio-stat-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<code class="parameter">path</code></dt>

    <dd>

     <p class="para">
     The file path
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">pri</code></dt>

    <dd>

     <p class="para">请求的优先级：<strong><code>EIO_PRI_DEFAULT</code></strong>，<strong><code>EIO_PRI_MIN</code></strong>，<strong><code>EIO_PRI_MAX</code></strong> 或 <strong><code>NULL</code></strong>。如果是
<strong><code>NULL</code></strong>，<code class="parameter">pri</code> 将设为
<strong><code>EIO_PRI_DEFAULT</code></strong>。
</p>

    </dd>

   
   
    <dt>
<code class="parameter">callback</code></dt>

    <dd>

     <p class="para">
<code class="parameter">callback</code>
函数在请求完成时被调用。其应匹配一下原型：<div class="example-contents"><div class="phpcode"><pre><span style="color: #000000">
void&nbsp;callback(mixed&nbsp;$data,&nbsp;int&nbsp;$result[,&nbsp;resource&nbsp;$req]);</span>
</pre></div></div>

<dl>

 
  <dt>
<code class="parameter">data</code></dt>

  <dd>
<p class="para">传递给请求的用户数据。</p></dd>

 
 
  <dt>
<code class="parameter">result</code></dt>

  <dd>
<p class="para">针对请求的结果的值。通常是相应的系统调用返回的值。</p></dd>

 
 
  <dt>
<code class="parameter">req</code></dt>

  <dd>
<p class="para">可选的请求资源，可被 <span class="function"><a href="eio_get_last_error.html" class="function">eio_get_last_error()</a></span>
   之类的函数使用。</p></dd>

 
</dl>

</p>

    </dd>

   
   
    <dt>
<code class="parameter">data</code></dt>

    <dd>

     <p class="para">
     Arbitrary variable passed to <code class="parameter">callback</code>.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.eio-stat-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   <span class="function"><strong>eio_stat()</strong></span> returns request resource on success or
   <strong><code>FALSE</code></strong> on error. On success assigns <code class="parameter">result</code> argument of
   <code class="parameter">callback</code> to an array.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.eio-stat-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-4289">
   <p><strong>Example #1 <span class="function"><strong>eio_stat()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$tmp_filename&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"eio-file.tmp"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">touch</span><span style="color: #007700">(</span><span style="color: #0000BB">$tmp_filename</span><span style="color: #007700">);<br /><br />function&nbsp;</span><span style="color: #0000BB">my_res_cb</span><span style="color: #007700">(</span><span style="color: #0000BB">$data</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$data</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br />}<br /><br />function&nbsp;</span><span style="color: #0000BB">my_open_cb</span><span style="color: #007700">(</span><span style="color: #0000BB">$data</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">eio_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">eio_event_loop</span><span style="color: #007700">();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;@</span><span style="color: #0000BB">unlink</span><span style="color: #007700">(</span><span style="color: #0000BB">$data</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #0000BB">eio_stat</span><span style="color: #007700">(</span><span style="color: #0000BB">$tmp_filename</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">EIO_PRI_DEFAULT</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"my_res_cb"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"eio_stat"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">eio_open</span><span style="color: #007700">(</span><span style="color: #0000BB">$tmp_filename</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">EIO_O_RDONLY</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,<br />&nbsp;</span><span style="color: #0000BB">EIO_PRI_DEFAULT</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"my_open_cb"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$tmp_filename</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">eio_event_loop</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
   </div>

   <div class="example-contents"><p>以上例程的输出类似于：</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
string(8) &quot;eio_stat&quot;
array(12) {
  [&quot;st_dev&quot;]=&gt;
  int(2050)
  [&quot;st_ino&quot;]=&gt;
  int(2489173)
  [&quot;st_mode&quot;]=&gt;
  int(33188)
  [&quot;st_nlink&quot;]=&gt;
  int(1)
  [&quot;st_uid&quot;]=&gt;
  int(1000)
  [&quot;st_gid&quot;]=&gt;
  int(100)
  [&quot;st_rdev&quot;]=&gt;
  int(0)
  [&quot;st_blksize&quot;]=&gt;
  int(4096)
  [&quot;st_blocks&quot;]=&gt;
  int(0)
  [&quot;st_atime&quot;]=&gt;
  int(1318250380)
  [&quot;st_mtime&quot;]=&gt;
  int(1318250380)
  [&quot;st_ctime&quot;]=&gt;
  int(1318250380)
}
</pre></div>
   </div>
  </div>
 </div>



 <div class="refsect1 seealso" id="refsect1-function.eio-stat-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member">eio_lstat</li>
   <li class="member">eio_fstat</li>
  </ul>
 </div>


</div></div></div></body></html>